<table id="datagrid_${action_id}"></table>
<script type="text/javascript">

$(function() {
	
	$('#datagrid_${action_id}').datagrid({
		iconCls:'icon-save',
		width:'auto',
		height:'auto',
		nowrap: false,
		fit:true,
		singleSelect:true,
		fitColumns:true,
		striped: true,
		sortName: 'id',
		sortOrder: 'asc',
		url:'${request.contextPath}${namespace?default('')}/mp/product/specificationsValue-datagrid.json?type=${type}',
		remoteSort: true,
		idField:'id',
		onBeforeLoad:function(){$('#datagrid_${action_id}').datagrid('unselectAll');},
		columns:[[
					{title:'${action.getDatagridTitle('value')}',field:'value',width:100,align:'center'}
					<#if image>
					,
					{title:'${action.getDatagridTitle('image')}',field:'image',width:100,align:'center',formatter:function(val,rec){
		            	if(val){
							return '<img style="width:64px;height:64px;" src="${downloadUrl?default('')}'+val+'?_v=${timeMillis}" />';
						}else{
							return '';
						}
		            }}
					</#if>
					,
					{field:'caozuo',title:'${action.getProperty('net.esj.background.message','bg.datagrid.action')}',width:120,align:'center',formatter:function(val, rec){
						return '<a href="javascript:;;" onclick="edit_${action_id}(\''+rec.id+'\')" >${action.getProperty('net.esj.background.message','bg.datagrid.modify')}</a>|<a href="javascript:;;" onclick="delete_${action_id}(\''+rec.id+'\')" >${action.getProperty('net.esj.background.message','bg.datagrid.delete')}</a>';
					}}
				]],
		pagination:true,
		rownumbers:true,
		onDblClickRow:function(idx,data){if(typeof onDblClickRow_${action_id} != 'undefined'){onDblClickRow_${action_id}(idx,data)}},
		onClickRow:function(idx,data){if(typeof onClickRow_${action_id} != 'undefined'){onClickRow_${action_id}(idx,data)}},
		onRowContextMenu:function(e,idx,data){if(typeof onRowContextMenu_${action_id} != 'undefined'){$(this).datagrid('selectRow', idx);onRowContextMenu_${action_id}(e,idx,data)}}
	});

});

</script>
